<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?=config_item('my_title')?></title>
    <base href="<?=base_url()?>">
    <link rel="stylesheet" href="plugin/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php require_once(VIEWPATH.'include/header.html');?>
<!-- 主内容区域 -->
<div class="container-fluid iframe-container">
    <?php require_once(VIEWPATH.'include/sidebar.html');?>
    <!-- 主面板 -->
    <div class="iframe-main">
        <div class="iframe-main-section">
            <div class="section_container">
                <div class="panel">
                    <div class="panel-heading">
                        <div class="panel-title"><?=$section_name.go_back()?></div>
                    </div>
                    <form class="form-horizontal ajax-form-hook" action="<?=$save_url?>" method="post">
                        <div class="panel-body">
                            <input type="hidden" name="pid" value="<?=$pid?>">
                            <div class="form-group">
                                <div class="col-xs-2 control-label">名称</div>
                                <div class="col-xs-3">
                                    <div class="input-group colorpicker-hook">
                                        <input type="text" name="name" class="form-control name-hook">
                                        <div class="input-group-addon"><i title="颜色选择器"></i></div>
                                        <input type="hidden" name="color">
                                    </div>
                                </div>
                                <?php if($this->session->sys_session['user_type']==0):?>
                                <div class="col-xs-2 checkbox">
                                    <label>
                                        <input type="checkbox" name="is_sys" value="1">
                                        <ins>设为系统字典</ins>
                                    </label>
                                </div>
                                <?php endif;?>
                            </div>
                            <div class="form-group">
                                <div class="col-xs-2 control-label">标记</div>
                                <div class="col-xs-2">
                                    <input type="text" name="ident" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-xs-2 control-label">字段名</div>
                                <div class="col-xs-2">
                                    <input type="text" name="field" class="form-control">
                                    <div class="help-block">指定保存位置</div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-xs-2 control-label">排序</div>
                                <div class="col-xs-2">
                                    <input type="text" name="sort" value="100" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-xs-offset-2 col-xs-8">
                                    <button type="submit" name="submit_type" value="1"
                                            class="btn btn-primary submit-hook">
                                        保存
                                    </button>
                                    <button type="submit" name="submit_type" value="2"
                                            class="btn btn-default submit-hook">保存并新增
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="plugin/require.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript">
    require(['unit', 'colorpicker'], function (unit) {
        unit.ajaxForm();
        $('.colorpicker-hook').colorpicker({
            input: 'input[name="color"]',
            color: "#333",
            colorSelectors: {
                '#333': '#333',//default
                '#007CF9': '#007CF9',//primary
                '#5cb85c': '#5cb85c',//success
                '#007fff': '#007fff',//info
                '#f0ad4e': '#f0ad4e',//warning
                '#d9534f': '#d9534f'//danger
            }
        }).on('changeColor', function (e) {
            $('input[name="name"]').css('color', e.color.toHex());
        });
    });
</script>
</body>
</html>